package misc;

import enums.ExportOptionsEnum;

/**
 * @author Jose Martin Rozanec;
 */
public class StudentSortingData implements Comparable {
    private ExportOptionsEnum compareBy;
    private String name;
    private double mark;
    private String printString;

    public StudentSortingData() {
    }

    public StudentSortingData(String name, double mark, String printString) {
        this.name = name;
        this.mark = mark;
        this.printString=printString;
    }

    public int compareTo(Object o) {
        switch (compareBy) {
            case SORT_BY_MARK:
                return (int)(getMark() - ((StudentSortingData) o).getMark());
            case SORT_BY_NAME:
                return ((Comparable) getName()).compareTo(o);
        }
        return 0;
    }

    public ExportOptionsEnum getCompareBy() {
        return compareBy;
    }

    public void setCompareBy(ExportOptionsEnum compareBy) {
        this.compareBy = compareBy;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getMark() {
        return mark;
    }

    public void setMark(int mark) {
        this.mark = mark;
    }

    public String getPrintString() {
        return printString;
    }

    public void setPrintString(String printString) {
        this.printString = printString;
    }

    public String toString(){
        return printString;
    }
}
